package com.taobao.api.request;

import java.util.List;
import com.taobao.api.internal.mapping.ApiField;
import com.taobao.api.internal.util.RequestCheckUtils;
import com.taobao.api.internal.mapping.ApiListField;
import com.taobao.api.TaobaoObject;
import java.util.Map;

import com.taobao.api.ApiRuleException;
import com.taobao.api.BaseTaobaoRequest;
import com.taobao.api.internal.util.TaobaoHashMap;
import com.taobao.api.internal.util.json.JSONWriter;
import com.taobao.api.response.OmniorderStoreGetconsignmailcodeResponse;

/**
 * TOP API: taobao.omniorder.store.getconsignmailcode request
 * 
 * @author top auto create
 * @since 1.0, 2018.07.25
 */
public class OmniorderStoreGetconsignmailcodeRequest extends BaseTaobaoRequest<OmniorderStoreGetconsignmailcodeResponse> {
	
	

	/** 
	* 淘宝(TB)、天猫(TM)、京东(JD)、当当(DD)、拍拍(PP)、易讯(YX)、ebay(EBAY)、QQ网购(QQ)      、亚马逊(AMAZON)、苏宁(SN)、国美(GM)、唯品会(WPH)、聚美(JM)、乐蜂(LF)、蘑菇街(MGJ)      、聚尚(JS)、拍鞋(PX)、银泰(YT)、1号店(YHD)、凡客(VANCL)、邮乐(YL)、优购(YG)、阿里      巴巴(1688)、其他(OTHERS)
	 */
	private String channel;

	/** 
	* 收件人信息
	 */
	private String receiver;

	/** 
	* 扩展信息
	 */
	private String sdtExtendInfoDTO;

	/** 
	* 发件人联系电话，如空则表示使用门店信息中的电话号码
	 */
	private String senderContact;

	/** 
	* 门店ID
	 */
	private Long storeId;

	/** 
	* 订单信息，目前一次请求只支持一个主订单
	 */
	private String trades;

	public void setChannel(String channel) {
		this.channel = channel;
	}

	public String getChannel() {
		return this.channel;
	}

	public void setReceiver(String receiver) {
		this.receiver = receiver;
	}

	public void setReceiver(ReceiverDto receiver) {
		this.receiver = new JSONWriter(false,true).write(receiver);
	}

	public String getReceiver() {
		return this.receiver;
	}

	public void setSdtExtendInfoDTO(String sdtExtendInfoDTO) {
		this.sdtExtendInfoDTO = sdtExtendInfoDTO;
	}

	public void setSdtExtendInfoDTO(SdtExtendInfoDto sdtExtendInfoDTO) {
		this.sdtExtendInfoDTO = new JSONWriter(false,true).write(sdtExtendInfoDTO);
	}

	public String getSdtExtendInfoDTO() {
		return this.sdtExtendInfoDTO;
	}

	public void setSenderContact(String senderContact) {
		this.senderContact = senderContact;
	}

	public String getSenderContact() {
		return this.senderContact;
	}

	public void setStoreId(Long storeId) {
		this.storeId = storeId;
	}

	public Long getStoreId() {
		return this.storeId;
	}

	public void setTrades(String trades) {
		this.trades = trades;
	}

	public void setTrades(List<TradeOrderInfoDto> trades) {
		this.trades = new JSONWriter(false,true).write(trades);
	}

	public String getTrades() {
		return this.trades;
	}

	public String getApiMethodName() {
		return "taobao.omniorder.store.getconsignmailcode";
	}

	public Map<String, String> getTextParams() {		
		TaobaoHashMap txtParams = new TaobaoHashMap();
		txtParams.put("channel", this.channel);
		txtParams.put("receiver", this.receiver);
		txtParams.put("sdt_extend_info_d_t_o", this.sdtExtendInfoDTO);
		txtParams.put("sender_contact", this.senderContact);
		txtParams.put("store_id", this.storeId);
		txtParams.put("trades", this.trades);
		if(this.udfParams != null) {
			txtParams.putAll(this.udfParams);
		}
		return txtParams;
	}

	public Class<OmniorderStoreGetconsignmailcodeResponse> getResponseClass() {
		return OmniorderStoreGetconsignmailcodeResponse.class;
	}

	public void check() throws ApiRuleException {
		RequestCheckUtils.checkNotEmpty(channel, "channel");
		RequestCheckUtils.checkNotEmpty(storeId, "storeId");
		RequestCheckUtils.checkObjectMaxListSize(trades, 20, "trades");
	}
	
	/**
 * 商品信息，非淘及散件必填，淘系订单以订单在淘宝系统内容为准
 *
 * @author top auto create
 * @since 1.0, null
 */
public static class TradeItemInfoDto extends TaobaoObject {

	private static final long serialVersionUID = 7183742148236289711L;

	/**
		 * 商品单价，单位为分
		 */
		@ApiField("amount")
		private Long amount;
		/**
		 * 商品数量
		 */
		@ApiField("count")
		private Long count;
		/**
		 * 商品id
		 */
		@ApiField("item_id")
		private String itemId;
		/**
		 * 商品名称
		 */
		@ApiField("name")
		private String name;
		/**
		 * 体积，单位为升
		 */
		@ApiField("volumn")
		private Long volumn;
		/**
		 * 重量，单位为克
		 */
		@ApiField("weight")
		private Long weight;
	

	public Long getAmount() {
			return this.amount;
		}
		public void setAmount(Long amount) {
			this.amount = amount;
		}
		public Long getCount() {
			return this.count;
		}
		public void setCount(Long count) {
			this.count = count;
		}
		public String getItemId() {
			return this.itemId;
		}
		public void setItemId(String itemId) {
			this.itemId = itemId;
		}
		public String getName() {
			return this.name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public Long getVolumn() {
			return this.volumn;
		}
		public void setVolumn(Long volumn) {
			this.volumn = volumn;
		}
		public Long getWeight() {
			return this.weight;
		}
		public void setWeight(Long weight) {
			this.weight = weight;
		}

}

	/**
 * 子订单信息
 *
 * @author top auto create
 * @since 1.0, null
 */
public static class TradeOrderDetailDto extends TaobaoObject {

	private static final long serialVersionUID = 7157129136639893371L;

	/**
		 * 商品信息，非淘及散件必填，淘系订单以订单在淘宝系统内容为准
		 */
		@ApiListField("items")
		@ApiField("trade_item_info_dto")
		private List<TradeItemInfoDto> items;
		/**
		 * 子订单ID，如果是单一订单，则主订单ID和子订单ID均填入同一值
		 */
		@ApiField("sub_order_id")
		private String subOrderId;
	

	public List<TradeItemInfoDto> getItems() {
			return this.items;
		}
		public void setItems(List<TradeItemInfoDto> items) {
			this.items = items;
		}
		public String getSubOrderId() {
			return this.subOrderId;
		}
		public void setSubOrderId(String subOrderId) {
			this.subOrderId = subOrderId;
		}

}

	/**
 * 订单信息，目前一次请求只支持一个主订单
 *
 * @author top auto create
 * @since 1.0, null
 */
public static class TradeOrderInfoDto extends TaobaoObject {

	private static final long serialVersionUID = 8458736923252485551L;

	/**
		 * 主订单ID
		 */
		@ApiField("main_order_id")
		private String mainOrderId;
		/**
		 * 子订单信息
		 */
		@ApiListField("sub_orders")
		@ApiField("trade_order_detail_dto")
		private List<TradeOrderDetailDto> subOrders;
	

	public String getMainOrderId() {
			return this.mainOrderId;
		}
		public void setMainOrderId(String mainOrderId) {
			this.mainOrderId = mainOrderId;
		}
		public List<TradeOrderDetailDto> getSubOrders() {
			return this.subOrders;
		}
		public void setSubOrders(List<TradeOrderDetailDto> subOrders) {
			this.subOrders = subOrders;
		}

}

	/**
 * 收件人信息
 *
 * @author top auto create
 * @since 1.0, null
 */
public static class ReceiverDto extends TaobaoObject {

	private static final long serialVersionUID = 5439642478158156971L;

	/**
		 * 收件人详细地址
		 */
		@ApiField("address")
		private String address;
		/**
		 * 城市
		 */
		@ApiField("city_name")
		private String cityName;
		/**
		 * 区县
		 */
		@ApiField("district_name")
		private String districtName;
		/**
		 * 收件人手机号，该字段与收件人电话二者必填至少其一
		 */
		@ApiField("mobile")
		private String mobile;
		/**
		 * 收件人电话
		 */
		@ApiField("phone")
		private String phone;
		/**
		 * 省
		 */
		@ApiField("pro_name")
		private String proName;
		/**
		 * 收件人姓名
		 */
		@ApiField("receiver_name")
		private String receiverName;
		/**
		 * 街道
		 */
		@ApiField("street_name")
		private String streetName;
	

	public String getAddress() {
			return this.address;
		}
		public void setAddress(String address) {
			this.address = address;
		}
		public String getCityName() {
			return this.cityName;
		}
		public void setCityName(String cityName) {
			this.cityName = cityName;
		}
		public String getDistrictName() {
			return this.districtName;
		}
		public void setDistrictName(String districtName) {
			this.districtName = districtName;
		}
		public String getMobile() {
			return this.mobile;
		}
		public void setMobile(String mobile) {
			this.mobile = mobile;
		}
		public String getPhone() {
			return this.phone;
		}
		public void setPhone(String phone) {
			this.phone = phone;
		}
		public String getProName() {
			return this.proName;
		}
		public void setProName(String proName) {
			this.proName = proName;
		}
		public String getReceiverName() {
			return this.receiverName;
		}
		public void setReceiverName(String receiverName) {
			this.receiverName = receiverName;
		}
		public String getStreetName() {
			return this.streetName;
		}
		public void setStreetName(String streetName) {
			this.streetName = streetName;
		}

}

	/**
 * 扩展信息
 *
 * @author top auto create
 * @since 1.0, null
 */
public static class SdtExtendInfoDto extends TaobaoObject {

	private static final long serialVersionUID = 8578359689229167116L;

	/**
		 * 电子面单上打印的发件地址
		 */
		@ApiField("waybill_print_address")
		private String waybillPrintAddress;
	

	public String getWaybillPrintAddress() {
			return this.waybillPrintAddress;
		}
		public void setWaybillPrintAddress(String waybillPrintAddress) {
			this.waybillPrintAddress = waybillPrintAddress;
		}

}


}